unit UFrmGrupo;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Buttons, Grids, DBGrids, StdCtrls, Mask, DBCtrls, ExtCtrls, RXCtrls,
  ComCtrls;

type
  TFrmGrupo = class(TForm)
    Panel1: TPanel;
    DBGrid1: TDBGrid;
    Panel2: TPanel;
    Label1: TLabel;
    DBEdit1: TDBEdit;
    DBEdit2: TDBEdit;
    Label2: TLabel;
    Label3: TLabel;
    RxLabel1: TRxLabel;
    Image1: TImage;
    Bevel1: TBevel;
    btnExcluir: TSpeedButton;
    btnGravar: TSpeedButton;
    SpeedButton1: TSpeedButton;
    btnAdicionar: TSpeedButton;
    btnRetornar: TSpeedButton;
    StatusBar1: TStatusBar;
    procedure btnExcluirClick(Sender: TObject);
    procedure btnGravarClick(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure btnAdicionarClick(Sender: TObject);
    procedure btnRetornarClick(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
    procedure FormKeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FrmGrupo: TFrmGrupo;

implementation

uses Modulo;

{$R *.DFM}

procedure TFrmGrupo.btnExcluirClick(Sender: TObject);
begin
    DMEscola.TGrupo.Edit;
    DMEscola.TGrupo.Delete;
end;

procedure TFrmGrupo.btnGravarClick(Sender: TObject);
begin
   DMEscola.TGrupo.Edit;
   DMEscola.TGrupo.Post;
end;

procedure TFrmGrupo.SpeedButton1Click(Sender: TObject);
begin
   DMEscola.TGrupo.Edit;
end;

procedure TFrmGrupo.btnAdicionarClick(Sender: TObject);
begin
   DMEscola.TGrupo.Append;
end;

procedure TFrmGrupo.btnRetornarClick(Sender: TObject);
begin
   close;
end;

procedure TFrmGrupo.FormClose(Sender: TObject; var Action: TCloseAction);
begin
   Action := Cafree;
end;

procedure TFrmGrupo.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
begin
   if MessageDlg('        Deseja realmente encerrar Cadastro de Grupos?',MtConfirmation,[mbyes, mbno],0) = mrno then
      Canclose := false;
end;

procedure TFrmGrupo.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
   if Key = VK_F7 then
      btnexcluir.Click;
   if Key = VK_F8 then
      btngravar.Click;
   if Key = VK_F9 then
      speedbutton1.Click;
   if Key = VK_F10 then
      btnadicionar.Click;
   if Key = VK_F12 then
      btnretornar.Click;
end;

end.
